/**
 * Created by Administrator on 2017/4/9 0009.
 */
var Page1={
    create:function () {
        var page={};

        page.ui=new PIXI.DisplayObjectContainer();

        var bg=Easy.CreateSprite('assets/images/bg.png',370.5,568,0.5,0.5,1);
        page.ui.addChild(bg);

        var i0=Easy.CreateSprite('assets/images/p1_i0.png',231,242,0.5,0.5,1);
        page.ui.addChild(i0);
        i0.alpha=0.0;
        // i0.blendMode=PIXI.BLEND_MODES.MULTIPLY;
        TweenMax.to(i0,1.5,{yoyo:true,repeat:-1,alpha:0.5,ease:Cubic.easeInOut});
        i0.interactive=true;
        i0.on('pointerdown',downHandler1);


        var i1=Easy.CreateSprite('assets/images/p1_i1.png',112,958,0.5,0.5,1);
        i1.alpha=0.3;
        page.ui.addChild(i1);
        i1.blendMode=PIXI.BLEND_MODES.ADD;
        TweenMax.to(i1,1.5,{yoyo:true,repeat:-1,alpha:0,ease:Cubic.easeInOut});
        i1.interactive=true;
        i1.on('pointerdown',downHandler2);

        var tip0=Easy.CreateSprite('assets/images/tip1.png',353,202,0.5,0.5,1);
        TweenMax.to(tip0,0.7,{yoyo:true,repeat:-1,alpha:0.5,ease:Cubic.easeInOut});
        tip0.scale.x=tip0.scale.y=1;
        TweenMax.to(tip0.scale,0.7,{yoyo:true,x:0.7,y:0.7,repeat:-1,ease:Cubic.easeInOut});
        page.ui.addChild(tip0);

        var tip1=Easy.CreateSprite('assets/images/tip1.png',136,938,0.5,0.5,0.5);
        TweenMax.to(tip1,0.7,{yoyo:true,repeat:-1,alpha:1,ease:Cubic.easeInOut});
        tip1.scale.x=tip1.scale.y=0.7;
        TweenMax.to(tip1.scale,0.7,{yoyo:true,repeat:-1,x:1,y:1,ease:Cubic.easeInOut});
        page.ui.addChild(tip1);

        var tip0=Easy.CreateSprite('assets/images/tip0.png',370,1100,0.5,0.5,1);
        page.ui.addChild(tip0);
        TweenMax.to(tip0,0.7,{yoyo:true,repeat:-1,y:1110,ease:Cubic.easeInOut});

        page.In=function () {
            console.log('hahaha')
        }
        page.Out=function () {

        }
        function downHandler1(e)
        {
            volumeChange(0);
            console.log('v1');
            document.getElementById('div_video1').style.zIndex=5;
            document.getElementById('mVideo1').play();
            document.getElementById('mVideo1').style.width=740*stage.scale.x+'px';
            document.getElementById('mVideo1').style.height=1136*stage.scale.y+'px';
            document.getElementById('mVideo1').style.left= stage.x+'px';
            document.getElementById('mVideo1').style.top= stage.y+'px';

            var md=document.getElementsByTagName("video")[0];
            md.addEventListener("ended",function(){
                volumeChange(1);
                console.log('end1')
                document.getElementById('div_video1').style.zIndex=2;
                document.getElementById('div_2d').style.zIndex=3;
            });
        }
        function downHandler2(e)
        {
            volumeChange(0);
            console.log('v2');
            document.getElementById('div_video2').style.zIndex=5;
            document.getElementById('mVideo2').play();
            document.getElementById('mVideo2').style.width=740*stage.scale.x+'px';
            document.getElementById('mVideo2').style.height=1136*stage.scale.y+'px';
            document.getElementById('mVideo2').style.left= stage.x+'px';
            document.getElementById('mVideo2').style.top= stage.y+'px';

            var md=document.getElementsByTagName("video")[1];
            md.addEventListener("ended",function(){
                volumeChange(1);
                document.getElementById('div_video2').style.zIndex=2;
                document.getElementById('div_2d').style.zIndex=3;
            });
        }

        return page;
    }
}